package com.dangdang.recursion.test0805;

import java.util.List;

/**
 * @Author Jiangnan Hou
 * @Date 2022/8/5
 */
public class OrderlyBrackets {

    public static void soulution(int size, int left, int right, String s){
        if (left == size && right == size) {
            System.out.println(s);
            return;
        }

        if (left < size) {
            soulution(size,left+1,right,s+"{");
        }

        if (right<left) {
            soulution(size,left,right+1,s+"}");
        }

    }

    public static void main(String[] args) {
        OrderlyBrackets.soulution(3,0,0,"");
    }
}
